Skip to content

fix(posting): mark removed split parts for reclamation - #9825

Open
KeisukeYamashita wants to merge 1 commit into
dgraph-io:mainfrom
KeisukeYamashita:codex/fix-orphan-split-cleanup-9824
Open

fix(posting): mark removed split parts for reclamation#9825
KeisukeYamashita wants to merge 1 commit into
dgraph-io:mainfrom
KeisukeYamashita:codex/fix-orphan-split-cleanup-9824

Conversation

@KeisukeYamashita

@KeisukeYamashita KeisukeYamashita commented Sep 4, 2026

Copy link
Copy Markdown

Refs #9824

Description

Write BitEmptyPosting records for split parts removed during rollup, allowing Badger compaction to reclaim their old payloads.

Use the replacement parent's timestamp, including the +1 for finite read timestamps, to preserve historical reads.

Add regression tests covering:

  • Partial and whole-list deletion for data, reverse, and index keys.
  • Splits created through normal mutations and rollup.
  • Historical reads, timestamp boundaries, reinsertion, delayed rollup writes, database reopen, and backup conversion.

Validation: the posting test suite, targeted race tests (three runs), targeted debug tests, and Dgraph build pass. Trunk has not yet been run.

This change does not remove empty-key metadata or retroactively clean up already-orphaned parts.

Checklist

  • The PR title follows the Conventional Commits syntax.
  • Code compiles correctly and linting (via trunk) passes locally.
  • Regression tests added for the bug fix.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes

    • Improved posting list rollups so reads referencing older split parts continue to work after compaction.
    • Preserved access to historical data during rollups, deletions, concurrent reads, and backup operations.
    • Reclaimed unreferenced split data after compaction while maintaining valid reads.
  • Tests

    • Added comprehensive coverage for split creation, cleanup, deletion modes, key types, timestamp boundaries, and historical reads.

@KeisukeYamashita
KeisukeYamashita requested a review from a team as a code owner September 4, 2026 08:30
@shiva-istari
shiva-istari force-pushed the codex/fix-orphan-split-cleanup-9824 branch 2 times, most recently from d5295a5 to 5e99229 Compare September 10, 2026 12:35
@matthewmcneely
matthewmcneely force-pushed the codex/fix-orphan-split-cleanup-9824 branch from 5e99229 to 5475bc3 Compare September 10, 2026 20:51
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 1fd05336-788b-4489-8082-d700cd9ba525

📥 Commits

Reviewing files that changed from the base of the PR and between 3656273 and 5475bc3.

📒 Files selected for processing (2)
  • posting/list.go
  • posting/split_cleanup_test.go

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

List.Rollup now writes empty, versioned parts for removed splits. New tests cover split creation, historical reads, reinsertion, timestamp boundaries, backup conversion, and reclamation across key kinds and deletion modes.

Changes

Posting split cleanup

Layer / File(s) Summary
Rollup removed-part preservation
posting/list.go
List.Rollup emits empty posting-list parts for removed splits using the main KV version.
Native split cleanup and historical reads
posting/split_cleanup_test.go
Tests validate native split cleanup, historical parent reads, concurrent reads, reinsertion, backups, and facet preservation.
Timestamp and key-kind coverage
posting/split_cleanup_test.go
Fixtures and tests cover data, reverse, and index keys, deletion modes, timestamp boundaries, and compaction reclamation.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: matthewmcneely, gooohgb

Merge Risk: 🟡 Moderate · up to 5475b

Posting rollups now write empty records for removed splits to enable reclamation. If split validation rejects this representation, deletion rollups could fail; the invariant should be confirmed before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: marking removed posting split parts for reclamation during rollup.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant